package com.zcah.dao;


import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class RedisUtil {

    // inject the template as ListOperations
    @Resource(name = "redisTemplate")
    private ListOperations<String, String> listOps;
    @Resource(name = "redisTemplate")
    private SetOperations<String, String> setOperations;


    public String popLink(String key) {
        return listOps.rightPop(key);
    }

    public long len(String key) {
        return listOps.size(key);
    }

    public long putMd5(String key, String value) {
        return setOperations.add(key, value);
    }

    public boolean containsMd5(String key, String value) {
        return setOperations.isMember(key, value);
    }
}


